﻿// ***********************************************************************
// Project			: Micua
// Assembly         : Micua.Common
// Author           : iceStone
// Created          : 2013-11-23 14:25
//
// Last Modified By : iceStone
// Last Modified On : 2013-11-23 14:25
// ***********************************************************************
// <copyright file="Statistics.cs" company="Wedn.Net">
//     Copyright (c) Wedn.Net. All rights reserved.
// </copyright>
// <summary>页面统计信息</summary>
// ***********************************************************************

using System;

namespace Micua.Model
{
    /// <summary>
    /// 页面统计信息
    /// </summary>
    /// <remarks>
    ///  2013-11-23 14:29 Created By iceStone
    /// </remarks>
    public class Statistics
    {
        /// <summary>
        /// 查询次数统计
        /// </summary>
        /// <value>The query count.</value>
        public int QueryCount { get; set; }
        /// <summary>
        /// 请求开始时间
        /// </summary>
        /// <value>The start time.</value>
        public DateTime StartTime { get; set; }
        /// <summary>
        /// 执行时间统计
        /// </summary>
        /// <value>The excute time.</value>
        public TimeSpan ExcuteTime { get { return DateTime.Now - StartTime; } }

        /// <summary>
        /// The _instance
        /// </summary>
        private static Statistics _instance;
        /// <summary>
        /// 统计实例
        /// </summary>
        /// <value>The instance.</value>
        public static Statistics Instance
        {
            get
            {
                if (_instance != null) return _instance;
                lock ("StatisticsLockHelper") { _instance = _instance ?? new Statistics(); }
                return _instance;
            }
        }
    }
}
